﻿
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Crawler.Framework.Repositories;
using Crawler.Model.SystemDefault;
using Crawler.IRepositories.SystemDefault;
using Microsoft.EntityFrameworkCore;
using SqlSugar;

namespace Crawler.Framework.Repositories.SystemDefault
{
    public class CollectorUrlRepository : Repository<CollectorUrlModel>, ICollectorUrlRepository
    {
        public CollectorUrlRepository(SqlSugarClient context) : base(context)
        {
        }

        public CollectorUrlModel GetExistUrlInfo(int configId, string url)
        {
            return context.Queryable< CollectorUrlModel >().Where(cu => cu.CollectorConfigID == configId && cu.Url == url).OrderBy(cu=>cu.AddTime, OrderByType.Desc).First();
        }
    }
}
